<!-- 产品结构与折扣 -->
<template>
  <div class="mainTable">
    <BaseTable :query="query" :tableItems="tableItems" :updateItems="updateItems" :methodParam="methodParam" :Btn="Btn"
      menuName="logRecord" pageName="mainTable" :optionList="optionList" />
  </div>
</template>
<script>
import dayjs from "dayjs"
import BaseTable from "../../../table/cpjgyzkTable.vue";
import { service } from "@/services/backServices"
export default {
  name: "cpjgyzk1",
  data() {
    return {
      //后端人员修改-S
      //查询参数
      query: [
        // { prop: "unit", type: "select", placeholder: "请选择时间粒度", value: "日", name: "时间粒度" },
        { prop: "targetStoreName", type: "select", placeholder: "", value: "洁婷旗舰店", name: "店铺名称" },
        {
          prop: "searchTime", type: "month", placeholder: "",
          // value: [dayjs(new Date()).add(-1, 'month').format("YYYY-MM-DD"), dayjs(new Date()).format("YYYY-MM-DD")],
          value: ["2023-01", "2023-01"],
          name: "查询时间"
        },
      ],
      //表格表头
      tableItems: [
        { name: "品牌名称", prop: "品牌名称", align: 'left', fixed: "left" },
        { name: "大系列", prop: "大系列", align: 'left', fixed: "left" },
        { name: "子系列", prop: "子系列", align: 'left', fixed: "left" },
        { name: "店铺", prop: "店铺", align: 'left', fixed: "left" },
        {
          name: "此店铺", align: 'center',
          children: [
            {
              name: "当前", align: 'center',
              children: [
                { name: "发货开单价", prop: "此店铺当前发货开单价" },
                { name: "销售", prop: "此店铺当前销售" },
                { name: "销售同比", prop: "此店铺当前销售同比" },
                { name: "折扣", prop: "此店铺当前折扣" },
                { name: "销售占比", prop: "此店铺当前销售占比" },
                { name: "占比涨跌同比", prop: "此店铺当前占比涨跌同比" },
              ],
            },
            {
              name: "累计", align: 'center',
              children: [
                { name: "发货开单价", prop: "此店铺累计发货开单价" },
                { name: "销售", prop: "此店铺累计销售" },
                { name: "销售同比", prop: "此店铺累计销售同比" },
                { name: "折扣", prop: "此店铺累计折扣" },
                { name: "销售占比", prop: "此店铺累计销售占比" },
                { name: "占比涨跌同比", prop: "此店铺累计占比涨跌同比" },
              ],
            }
          ]
        },
        {
          name: "全店铺", align: 'center',
          children: [
            {
              name: "当前", align: 'center',
              children: [
                { name: "发货开单价", prop: "全店铺当前发货开单价" },
                { name: "销售", prop: "全店铺当前销售" },
                { name: "销售同比", prop: "全店铺当前销售同比" },
                { name: "折扣", prop: "全店铺当前折扣" },
                { name: "销售占比", prop: "全店铺当前销售占比" },
                { name: "占比涨跌同比", prop: "全店铺当前占比涨跌同比" },
              ],
            },
            {
              name: "累计", align: 'center',
              children: [
                { name: "发货开单价", prop: "全店铺累计发货开单价" },
                { name: "销售", prop: "全店铺累计销售" },
                { name: "销售同比", prop: "全店铺累计销售同比" },
                { name: "折扣", prop: "全店铺累计折扣" },
                { name: "销售占比", prop: "全店铺累计销售占比" },
                { name: "占比涨跌同比", prop: "全店铺累计占比涨跌同比" },
              ],
            }
          ]
        },
      ],
      //增删查改的对象属性
      updateItems: [//edit是回复
        { name: "文件名称", prop: "fileName", type: "input", disabled: true },
        { name: "上传类型", prop: "uploadType", type: "select" },
        { name: "备注", prop: "remark", type: "textarea" },
        { name: "上传文件", prop: "fileAdd", type: "upload" },
      ],
      optionList: {
        targetStoreName: [],
      },
      //增删查改方法参数
      methodParam: "pinxiangExe",
      //自定义btn功能
      Btn: {
        search: true, //查询按钮
        add: false, //添加按钮
        edit: false, //回复按钮
        detail: false, //详情按钮
        delete: false, //删除按钮
        deletes: false, //批量删除按钮
        export: true, //导出按钮
        templateDownload: false, //模板下载按钮
        upload: false, //上传按钮
      },
      //后端人员修改-E
    };
  },
  methods: {
    // 查询条件 获取店铺列表
    getShopList() {
      service({
        url: "getAllShopName",
        method: "post"
      }).then(res => {
        this.optionList.targetStoreName = [
          { label: "全店铺", value: "全店铺" },
        ]
        if (res.data.code == 200) {
          res.data.data.forEach(v => {
            this.optionList.targetStoreName.push({ label: v, value: v })
          })
        }
      })
    }
  },
  components: {
    BaseTable
  },
  created() {
    this.getShopList()
  }
};
</script>
<style scoped lang="less">
.mainTable {
  background-color: #f1f2f9;
}
</style>